package com.xpffly.design.mediator;

import com.xpffly.design.mediator.service.AbstractMediator;
import com.xpffly.design.mediator.service.impl.ConcertMediator;
import com.xpffly.design.mediator.service.impl.Purchase;
import com.xpffly.design.mediator.service.impl.Sale;
import com.xpffly.design.mediator.service.impl.Stock;

/**
 * @Author: xpengfei
 * @Date: 2021/4/3 23:39
 * @Description：中介者模式场景类
 */
public class Scene {
    public static void main(String[] args) {
        // 定义中介者
        AbstractMediator mediator = new ConcertMediator();
        System.out.println("-------------采购人员采购电脑-----------");
        Purchase purchase = new Purchase(mediator);
        purchase.buyIBMComputer(100);
        System.out.println("-------------销售人员销售电脑-----------");
        Sale sale = new Sale(mediator);
        sale.sellIBMComputer(1);
        System.out.println("-------------库存管理人员清仓处理-----------");
        Stock stock = new Stock(mediator);
        stock.clearStock();
    }
}
